package myLucene;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class GetTime {

	public static String getDuration(long start, long end) {
		long millis = end - start;
		String time = String.format("%d min, %d sec", TimeUnit.MILLISECONDS
				.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis)
				- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
						.toMinutes(millis)));
		return time;
	}

	public static String getTime() {

		DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
		Date date = new Date();

		return dateFormat.format(date);

	}
}
